{ ***  cef_stream_capi.h  *** }

  PCefReadHandler = ^TCefReadHandler;
  PCefStreamReader = ^TCefStreamReader;
  PCefWriteHandler = ^TCefWriteHandler;
  PCefStreamWriter = ^TCefStreamWriter;

  // Structure the client can implement to provide a custom stream reader. The
  // functions of this structure may be called on any thread.
  TCefReadHandler = record
    // Base structure.
    base: TCefBase;

    // Read raw binary data.
    read: function(self: PCefReadHandler; ptr: Pointer; size, n: csize_t): csize_t; cconv;

    // Seek to the specified offset position. |whence| may be any one of SEEK_CUR,
    // SEEK_END or SEEK_SET. Return zero on success and non-zero on failure.
    seek: function(self: PCefReadHandler; offset: Int64; whence: Integer): Integer; cconv;

    // Return the current offset position.
    tell: function(self: PCefReadHandler): Int64; cconv;

    // Return non-zero if at end of file.
    eof: function(self: PCefReadHandler): Integer; cconv;

    // Return true (1) if this handler performs work like accessing the file
    // system which may block. Used as a hint for determining the thread to access
    // the handler from.
    //int (CEF_CALLBACK *may_block)(struct _cef_read_handler_t* self);
    may_block: function(self: PCefReadHandler): Integer; cconv;
  end;


  // Structure used to read data from a stream. The functions of this structure
  // may be called on any thread.
  TCefStreamReader = record
    // Base structure.
    base: TCefBase;

    // Read raw binary data.
    read: function(self: PCefStreamReader; ptr: Pointer;
        size, n: csize_t): csize_t; cconv;

    // Seek to the specified offset position. |whence| may be any one of SEEK_CUR,
    // SEEK_END or SEEK_SET. Returns zero on success and non-zero on failure.
    seek: function(self: PCefStreamReader; offset: Int64;
        whence: Integer): Integer; cconv;

    // Return the current offset position.
    tell: function(self: PCefStreamReader): Int64; cconv;

    // Return non-zero if at end of file.
    eof: function(self: PCefStreamReader): Integer; cconv;

    // Return true (1) if this handler performs work like accessing the file
    // system which may block. Used as a hint for determining the thread to access
    // the handler from.
    //int (CEF_CALLBACK *may_block)(struct _cef_read_handler_t* self);
    may_block: function(self: PCefStreamReader): Integer; cconv;
  end;


  // Structure the client can implement to provide a custom stream writer. The
  // functions of this structure may be called on any thread.
  TCefWriteHandler = record
    // Base structure.
    base: TCefBase;

    // Write raw binary data.
    write: function(self: PCefWriteHandler;
        const ptr: Pointer; size, n: csize_t): csize_t; cconv;

    // Seek to the specified offset position. |whence| may be any one of SEEK_CUR,
    // SEEK_END or SEEK_SET. Return zero on success and non-zero on failure.
    seek: function(self: PCefWriteHandler; offset: Int64;
        whence: Integer): Integer; cconv;

    // Return the current offset position.
    tell: function(self: PCefWriteHandler): Int64; cconv;

    // Flush the stream.
    flush: function(self: PCefWriteHandler): Integer; cconv;

    // Return true (1) if this handler performs work like accessing the file
    // system which may block. Used as a hint for determining the thread to access
    // the handler from.
    //int (CEF_CALLBACK *may_block)(struct _cef_read_handler_t* self);
    may_block: function(self: PCefWriteHandler): Integer; cconv;
  end;


  // Structure used to write data to a stream. The functions of this structure may
  // be called on any thread.
  TCefStreamWriter = record
    // Base structure.
    base: TCefBase;

    // Write raw binary data.
    write: function(self: PCefStreamWriter;
        const ptr: Pointer; size, n: csize_t): csize_t; cconv;

    // Seek to the specified offset position. |whence| may be any one of SEEK_CUR,
    // SEEK_END or SEEK_SET. Returns zero on success and non-zero on failure.
    seek: function(self: PCefStreamWriter; offset: Int64;
        whence: Integer): Integer; cconv;

    // Return the current offset position.
    tell: function(self: PCefStreamWriter): Int64; cconv;

    // Flush the stream.
    flush: function(self: PCefStreamWriter): Integer; cconv;

    // Return true (1) if this handler performs work like accessing the file
    // system which may block. Used as a hint for determining the thread to access
    // the handler from.
    //int (CEF_CALLBACK *may_block)(struct _cef_read_handler_t* self);
    may_block: function(self: PCefStreamWriter): Integer; cconv;
  end;

    // Create a new cef_stream_reader_t object from a file.
    tfn_cef_stream_reader_create_for_file = function(
        const fileName: PCefString): PCefStreamReader; cdecl;

    // Create a new cef_stream_reader_t object from data.
    tfn_cef_stream_reader_create_for_data = function(
        data: Pointer;
        size: csize_t): PCefStreamReader; cdecl;

    // Create a new cef_stream_reader_t object from a custom handler.
    tfn_cef_stream_reader_create_for_handler = function(
        handler: PCefReadHandler): PCefStreamReader; cdecl;

    // Create a new cef_stream_writer_t object for a file.
    tfn_cef_stream_writer_create_for_file = function(
        const fileName: PCefString): PCefStreamWriter; cdecl;

    // Create a new cef_stream_writer_t object for a custom handler.
    tfn_cef_stream_writer_create_for_handler = function(
        handler: PCefWriteHandler): PCefStreamWriter; cdecl;

